﻿
using Messhall.Domain.Permission.BusinessObjects;
using Messhall.Framework.Repository.Repositorys;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Messhall.Repository.Permission.EntityTypeConfigurations
{
    public class UsersEntityConfiguration : EntityTypeConfigurationBase<UsersEntity>
    {
        public override void Configure(EntityTypeBuilder<UsersEntity> builder)
        {
            builder.ToTable("users");
            builder.Property(c => c.Name).HasMaxLength(50).IsRequired();
            builder.Property(c => c.Mobile).HasMaxLength(20).IsRequired();
            builder.Property(c => c.AccountNo).HasMaxLength(20).IsRequired();
            builder.Property(c => c.PassWord).HasMaxLength(100).IsRequired();
            builder.Property(c => c.Money).HasColumnType("numeric").HasPrecision(18, 2).IsRequired();
            builder.Property(c => c.Integral).HasDefaultValue(decimal.Zero).IsRequired();
            builder.Property(c => c.IsVip).HasDefaultValue(false).IsRequired();

            base.Configure(builder);
        }
    }
}
